package two_shang._10_26;

class NoThisSongException extends Exception {
    public NoThisSongException() {
    }

    public NoThisSongException(String message) {
        super(message);
    }
}

class Player {
    public void play(int index) throws NoThisSongException {
        if (index > 10) {
            throw new NoThisSongException("您播放的歌曲不存在");
        }
        System.out.println("正在播放歌曲：Fight Song   " + index);
    }
}

public class MyErrorTest {
    public static void main(String[] args) {
        Player player = new Player();
        try {
            player.play(7);
            player.play(11);
        } catch (NoThisSongException e) {
            System.out.println("异常信息为： " + e.getMessage());
        }
    }
}
